import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
import { lazy } from 'react'
import ErrorPage from '../pages/ErrorPage'
import { PdfGenerator } from '../components/PdfGenerator/PdfGenerator'

// 使用懒加载提升性能
const ExcelDemo = lazy(() => import('../pages/excelDemo/ExcelDemo'))

// 路由配置
export const router = createBrowserRouter([
  {
    path: '/',
    element: <App />, // 主布局组件
    errorElement: <ErrorPage />,
    children: [
      {
        path: 'excelDemo',
        element: <ExcelDemo />
      },
      {
        path: 'pdf-generator',
        element: <PdfGenerator />
      }
    ]
  }
])
